package com.web.servlet;


import com.web.entity.Administrator;
import com.web.serviceimpl.AdministratorServiceImpl;
import com.web.service.AdministratorService;
import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 创建一个Servlet类，用于处理验证登录
 * 
 * 
 */
@WebServlet("/al")
public class ALoginServlet  extends HttpServlet{

    AdministratorService administratorService = (AdministratorService) new AdministratorServiceImpl();
    
    

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //1. 获取请求参数
        String Aid=req.getParameter("Aid");
        String Apwd = req.getParameter("Apwd");
        
        
        //2. 执行业务逻辑
        Administrator administrator = administratorService.valedateLogin(Aid, Apwd);

        //3. 生成响应内容
        req.getRequestDispatcher("/Administrator.jsp").forward(req, resp);
    }

    @Override
    public String getServletInfo() {
        return "Okay";
    }

    @Override
    public void destroy() {
        
    }
    
}
